<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>   
<script type="text/javascript">

function pi_saveplugin(type)
{
    if (document.getElementById("hasActionErrors"))
    {
        alert("选择错误！");
        return false;
    }

    var name = document.getElementById("plugin.name").value;
    var pkgname = document.getElementById("plugin.pkgname").value;
    if (name == null || name == ""
        || pkgname == null || pkgname == "")
    {
        alert("信息不完整！");
        return false;
    }

    if (!confirm("确定继续？"))
    {
        return false;
    }
    var url = "pi/plugin/save.do?type=" + type;
    /*alert(content);*/
    var objectid = "pi_plugin";
    postXMLHttpRequest(url, "myform", objectid); 
}
</script>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>   
  <form id="myform" name="myform" id="myform" enctype="multipart/form-data" 
        method="post" action="">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="25" colspan="3" class="table_blue">
        <strong><img src="images/dot.jpg" width="13" height="9">插件信息</strong></td>
    </tr> 
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>类型：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input type="hidden" id="plugin.id" name="plugin.id" value="<s:property value="plugin.id"/>" />
        <select id="plugin.type" dojoType="dijit.form.FilteringSelect" 
            name="plugin.type" style="width:280px;" >
            <s:iterator value="%{getConstant('plugin type')}">
            <option value="<s:property value="key" />" <s:if test="key.equals(plugin.type)">selected</s:if> ><s:property value="value"/></option>
            </s:iterator>
        </select></td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>名称：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="plugin.name" name="plugin.name" type="text" size="60" value="<s:property value="plugin.name"/>" /></td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>包名：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="plugin.pkgname" name="plugin.pkgname" type="text" size="60" value="<s:property value="plugin.pkgname"/>" /></td>
    </tr>
    <tr>
      <td colspan="3" class="table_w1" align="center">
        <s:if test="type.equals('insert')" >
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="pi_saveplugin('insert');">添加</button>
        </s:if>
        <s:else>
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="pi_saveplugin('update');">修改</button>
        &nbsp;&nbsp;        
        <button id="btn3" dojoType="dijit.form.Button"
            onclick="pi_saveplugin('delete');">删除</button>
        </s:else>
      </td>      
    </tr>
    <tr> 
      <td colspan="3" background="images/table_bom_bg.jpg">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/table_bom_left.jpg" width="20" height="15"></td>
          <td></td>
          <td align="right">
            <img src="images/table_bom_right.jpg" width="20" height="15"></td>
        </tr>
        </table>
      </td>
    </tr>
  </table>  
  </form>
  </td>
  <td width="5"></td>
  </tr>
  </table>